package com.bestillet.kyllingogco;

import java.util.ArrayList;

import android.os.Parcel;
import android.os.Parcelable;

public class Card implements Parcelable {
	private ArrayList<Stamp> stamps;
	
	private String name;
	
	private int idx, amount, position;
	
	public Card(String name, int idx, int amount, int position) {
		stamps = new ArrayList<Stamp>();
		this.name = name;
		this.idx = idx;
		this.amount = amount;
		this.position = position;
	}
	
	public Card() {
		stamps = new ArrayList<Stamp>();
	}
	

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getIdx() {
		return idx;
	}

	public void setIdx(int idx) {
		this.idx = idx;
	}

	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}
	
	public int getPosition() {
		return position;
	}

	public void setPosition(int position) {
		this.position = position;
	}

	public ArrayList<Stamp> getStamps() {
		return new ArrayList<Stamp>(stamps);
	}
	
	public void addStamp(Stamp stamp) {
		stamps.add(stamp);
	}
	
	public void removeStamp(Stamp stamp) {
		stamps.remove(stamp);
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel out, int flags) {
		out.writeString(name);
		out.writeInt(idx);
		out.writeInt(amount);
		out.writeInt(position);
	}
	
	public static final Parcelable.Creator<Card> CREATOR = new Parcelable.Creator<Card>() {
		@Override
		public Card createFromParcel(Parcel in) {
			return new Card(in);
		}

		@Override
		public Card[] newArray(int size) {
			return new Card[size];
		}
	};
	
	private Card(Parcel in) {
		stamps = new ArrayList<Stamp>();
		name = in.readString();
		idx = in.readInt();
		amount = in.readInt();
		position = in.readInt();
	}
}